package io.sunshower.lang.common.encodings

import io.sunshower.lang.primitives.Rope
import spock.lang.Specification

import java.nio.charset.Charset

class SpockBase58Test extends Specification {


    def "encoding ropes arrays in base58 must work"() {

        expect:
        Encodings.create(Encodings.Type.Base58).encode(lhs) == rhs
        where:
        lhs << [
                "1",
                "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Tortor id aliquet lectus proin nibh. Quis commodo odio aenean sed adipiscing diam donec. Proin sagittis nisl rhoncus mattis rhoncus urna. Consequat interdum varius sit amet. Ultrices in iaculis nunc sed augue lacus. Pharetra magna ac placerat vestibulum lectus mauris ultrices. Faucibus scelerisque eleifend donec pretium vulputate sapien nec sagittis. Ultricies integer quis auctor elit sed vulputate mi sit amet. Consectetur adipiscing elit pellentesque habitant morbi. Integer eget aliquet nibh praesent tristique. Posuere lorem ipsum dolor sit amet consectetur adipiscing. Imperdiet massa tincidunt nunc pulvinar sapien. Dictum varius duis at consectetur lorem donec massa sapien. Mattis molestie a iaculis at erat pellentesque adipiscing commodo elit. Id eu nisl nunc mi ipsum faucibus. Risus pretium quam vulputate dignissim suspendisse in est.\n" +
                        "\n" +
                        "Fames ac turpis egestas sed tempus. Augue interdum velit euismod in pellentesque massa placerat duis. Dictumst quisque sagittis purus sit amet volutpat consequat mauris nunc. Sed vulputate mi sit amet mauris. Volutpat diam ut venenatis tellus in metus vulputate eu. Vitae proin sagittis nisl rhoncus mattis. Felis donec et odio pellentesque diam volutpat commodo sed. Donec ultrices tincidunt arcu non sodales. Aliquet nec ullamcorper sit amet risus. Est ante in nibh mauris cursus mattis molestie a. Neque viverra justo nec ultrices. Volutpat odio facilisis mauris sit amet massa vitae tortor condimentum. Quam lacus suspendisse faucibus interdum posuere.\n" +
                        "\n" +
                        "Nulla posuere sollicitudin aliquam ultrices sagittis orci a scelerisque. Tincidunt ornare massa eget egestas. Tortor dignissim convallis aenean et tortor at. Eget lorem dolor sed viverra ipsum nunc aliquet bibendum. Bibendum est ultricies integer quis auctor elit sed. Condimentum vitae sapien pellentesque habitant morbi tristique senectus et. Lectus nulla at volutpat diam ut venenatis tellus in metus. Platea dictumst vestibulum rhoncus est pellentesque elit ullamcorper dignissim. Est ultricies integer quis auctor. Cras sed felis eget velit aliquet sagittis id consectetur. Turpis egestas pretium aenean pharetra magna ac placerat vestibulum lectus. Donec adipiscing tristique risus nec. Et sollicitudin ac orci phasellus egestas tellus rutrum tellus. Lorem sed risus ultricies tristique nulla aliquet enim tortor at. Odio facilisis mauris sit amet massa vitae tortor condimentum lacinia. Et sollicitudin ac orci phasellus egestas. Eu feugiat pretium nibh ipsum consequat. Ut sem nulla pharetra diam sit.\n" +
                        "\n" +
                        "Egestas fringilla phasellus faucibus scelerisque. Sed ullamcorper morbi tincidunt ornare massa. Lectus vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt. Habitasse platea dictumst vestibulum rhoncus est pellentesque elit. Cursus euismod quis viverra nibh cras pulvinar. Ac felis donec et odio pellentesque diam. Feugiat nibh sed pulvinar proin gravida hendrerit lectus. Praesent tristique magna sit amet. Eu ultrices vitae auctor eu augue. Sapien eget mi proin sed libero enim sed faucibus. Tempus quam pellentesque nec nam aliquam sem et tortor consequat. Urna id volutpat lacus laoreet non. Tortor dignissim convallis aenean et tortor at risus viverra. Habitant morbi tristique senectus et netus et malesuada fames ac. Donec massa sapien faucibus et molestie ac feugiat sed. Nulla facilisi morbi tempus iaculis urna id volutpat. Sed vulputate odio ut enim.\n" +
                        "\n" +
                        "Justo nec ultrices dui sapien. Iaculis eu non diam phasellus vestibulum lorem sed risus. Bibendum enim facilisis gravida neque convallis a cras semper auctor. Aliquam vestibulum morbi blandit cursus risus. Nullam eget felis eget nunc lobortis mattis aliquam faucibus. Amet dictum sit amet justo. Pulvinar proin gravida hendrerit lectus. Semper feugiat nibh sed pulvinar proin gravida hendrerit lectus. Suspendisse interdum consectetur libero id. Ipsum dolor sit amet consectetur adipiscing elit duis. Aliquam sem et tortor consequat id porta nibh. Enim nulla aliquet porttitor lacus luctus accumsan tortor posuere ac. Feugiat scelerisque varius morbi enim nunc. Tellus molestie nunc non blandit massa. Bibendum est ultricies integer quis auctor elit sed vulputate. Massa massa ultricies mi quis hendrerit dolor magna eget.\n" +
                        "\n" +
                        "Etiam erat velit scelerisque in dictum. Magnis dis parturient montes nascetur ridiculus mus. Consectetur adipiscing elit duis tristique. Cras pulvinar mattis nunc sed. Posuere ac ut consequat semper viverra nam libero justo laoreet. Euismod quis viverra nibh cras pulvinar mattis. Faucibus scelerisque eleifend donec pretium vulputate sapien nec. Tristique senectus et netus et malesuada fames. Non curabitur gravida arcu ac tortor dignissim convallis aenean. In hendrerit gravida rutrum quisque non tellus orci. Tortor id aliquet lectus proin nibh nisl. Non consectetur a erat nam at. Pellentesque adipiscing commodo elit at imperdiet dui accumsan. Nisi est sit amet facilisis magna. Natoque penatibus et magnis dis parturient montes. Rhoncus est pellentesque elit ullamcorper dignissim cras tincidunt lobortis.\n" +
                        "\n" +
                        "At consectetur lorem donec massa sapien faucibus et. Sed turpis tincidunt id aliquet. Duis at consectetur lorem donec massa sapien. Commodo ullamcorper a lacus vestibulum sed arcu non odio euismod. Egestas purus viverra accumsan in nisl. Amet nisl suscipit adipiscing bibendum est ultricies integer quis auctor. Et tortor consequat id porta nibh. Ultricies leo integer malesuada nunc vel. Et leo duis ut diam quam. Tristique senectus et netus et malesuada. Consequat interdum varius sit amet.\n" +
                        "\n" +
                        "Pellentesque habitant morbi tristique senectus et. Consectetur purus ut faucibus pulvinar elementum integer enim neque volutpat. Metus vulputate eu scelerisque felis imperdiet proin. Gravida rutrum quisque non tellus. Odio facilisis mauris sit amet massa vitae. Magna eget est lorem ipsum dolor sit amet. Eu feugiat pretium nibh ipsum consequat nisl vel pretium. Convallis aenean et tortor at risus. Proin libero nunc consequat interdum varius. Quis enim lobortis scelerisque fermentum. Condimentum lacinia quis vel eros.\n" +
                        "\n" +
                        "Sem fringilla ut morbi tincidunt augue. Tristique senectus et netus et malesuada fames ac. Integer enim neque volutpat ac tincidunt vitae semper. Lectus nulla at volutpat diam ut venenatis tellus in. Ullamcorper morbi tincidunt ornare massa eget egestas purus viverra. Orci eu lobortis elementum nibh tellus molestie. Tristique nulla aliquet enim tortor at auctor. Sed odio morbi quis commodo. Facilisis gravida neque convallis a cras semper. Ultrices vitae auctor eu augue ut lectus arcu bibendum. Ac placerat vestibulum lectus mauris ultrices eros. Enim nulla aliquet porttitor lacus luctus accumsan tortor posuere ac. Id faucibus nisl tincidunt eget nullam non nisi. Dolor sit amet consectetur adipiscing elit ut.\n" +
                        "\n" +
                        "Tellus cras adipiscing enim eu turpis egestas. Erat velit scelerisque in dictum. Fermentum leo vel orci porta. Enim ut sem viverra aliquet eget sit. Dolor sed viverra ipsum nunc aliquet bibendum enim facilisis gravida. Sed ullamcorper morbi tincidunt ornare massa eget egestas purus viverra. Justo donec enim diam vulputate ut pharetra sit. At varius vel pharetra vel turpis nunc eget. Pretium quam vulputate dignissim suspendisse in est ante in. Et netus et malesuada fames ac turpis egestas integer. Sed faucibus turpis in eu mi bibendum neque egestas. In fermentum et sollicitudin ac orci phasellus egestas tellus. Egestas egestas fringilla phasellus faucibus scelerisque eleifend donec. Turpis cursus in hac habitasse platea dictumst.\n" +
                        "\n" +
                        "Sit amet cursus sit amet dictum. Odio tempor orci dapibus ultrices in. Phasellus egestas tellus rutrum tellus pellentesque eu tincidunt tortor aliquam. Nec dui nunc mattis enim ut. Aliquet eget sit amet tellus cras adipiscing. At varius vel pharetra vel turpis. Viverra ipsum nunc aliquet bibendum enim facilisis. Magna etiam tempor orci eu lobortis elementum nibh tellus molestie. Condimentum lacinia quis vel eros donec ac odio. Parturient montes nascetur ridiculus mus mauris vitae ultricies leo integer. Aliquam eleifend mi in nulla posuere sollicitudin aliquam ultrices. Ornare massa eget egestas purus viverra accumsan in. Senectus et netus et malesuada fames ac turpis. Nunc vel risus commodo viverra maecenas. Donec et odio pellentesque diam volutpat commodo sed. Non consectetur a erat nam at lectus urna duis.\n" +
                        "\n" +
                        "Sed libero enim sed faucibus. Vel quam elementum pulvinar etiam non quam lacus. Enim lobortis scelerisque fermentum dui faucibus in. Aliquam purus sit amet luctus venenatis. Et magnis dis parturient montes nascetur ridiculus mus mauris. Sed libero enim sed faucibus turpis in. Ante in nibh mauris cursus mattis molestie a iaculis at. Quam nulla porttitor massa id neque aliquam vestibulum. Vitae congue mauris rhoncus aenean vel elit. Ac tortor dignissim convallis aenean et tortor at. Laoreet sit amet cursus sit amet dictum. Massa vitae tortor condimentum lacinia quis. Tortor dignissim convallis aenean et tortor at risus viverra. Mauris in aliquam sem fringilla ut morbi. Sed adipiscing diam donec adipiscing tristique. Feugiat nisl pretium fusce id velit ut tortor. Felis bibendum ut tristique et egestas quis. Venenatis tellus in metus vulputate eu scelerisque felis imperdiet. Elementum integer enim neque volutpat.\n" +
                        "\n" +
                        "Odio pellentesque diam volutpat commodo. Lacus suspendisse faucibus interdum posuere lorem ipsum dolor. Diam phasellus vestibulum lorem sed risus ultricies tristique nulla aliquet. Consectetur lorem donec massa sapien faucibus et molestie ac feugiat. Pellentesque habitant morbi tristique senectus et netus et. Donec adipiscing tristique risus nec feugiat in fermentum posuere. Nunc sed id semper risus in hendrerit. Nisi est sit amet facilisis. Consequat semper viverra nam libero justo laoreet. Facilisis leo vel fringilla est ullamcorper eget nulla facilisi. Nec tincidunt praesent semper feugiat nibh sed pulvinar proin. Turpis egestas integer eget aliquet nibh praesent tristique magna sit.\n",
                "18375 0cZcvfq3452g.dmas.,madsfg2301534760dsa.fmadfvzcvbzfgbwer6598u'l\n" +
                        "a'dsffavc`q0",
        ].collect(c -> new Rope(c))

        rhs << [
                "r",
                "6yjReW3i36ZcoFAjxcovEFwpzjxYTn2qknaz9ifmmsAubFpd4eXbQaZ3xif4twPyLFcgQjBG7esyHRsYm5zap6ch9Sh4WaayxYp3pPVXLEDHVmt9rPC9btuzRzyAJJKpxSpzfifjsrtHfjXC9gvjFh6icrYurFcrLMEfqNok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X5eiYhyG8aXDgwPU5EgwkqshkbbrMPfMyDJqCQ1tapEtFpaqbmLZ334HJZhrLfwRtfYFXuMkwpprWkSWJ31yZzce6CHyAs3Adj4bBge9twTwhcpfmVEndRzqn65CNzYoVgrvLGiHk34VgjskdPY7HKyDrFyfBpgf3UR8qD221pWJK5yPXVsNukRaCfNUUSK7hQCwhWiJCqvu96TMLGAM6TLtcmqQnXV6LVNrRKCJA7GVVtyk32EFEa53MwFkFmpNXE3FPnane168NFFwtwrv5NJtwpQw4Vwa8iLphTcMShka2Yy5uS69ywj4Kkii2aXKgNxGuwFn65sQJrJ2nb4ngUd4mbspJjXFWPjCnt5PZDUoS2Ed2LfbuLpfmALFS5noRvZfWggsTA6q6um4KABn35iddfN5vZctePekpYtw8orCKaRNkR6MVRzvkL3zJopTNCnN2DUHoLZiYPx79Ep8Y6QytK2CjZzGGjDeZBGD3QFKabxc1vQtyeqjcm1jziRLJyKNUpjh94PfJbBk377hQZ3nNSzoH1UmhBqVLPuhKdZfo",
                "BT2qnoVRJxC2De4rroim3qC3YUrMx98ccXJxD1deyL6s6WDsXoeKU4tHVYAAz6x5SouurpNAwVTvirZf2bzxBDbpFJcoDHbM5yABsdU78WzoucgF"
        ].collect(c -> new Rope(c))
    }

    def "encoding byte arrays in base58 must work"() {

        expect:
        Encodings.create(Encodings.Type.Base58).encode(lhs.getBytes()) == rhs
        where:
        lhs << [
                "1",
                "à̴̡̨͕̞̭̖͔̰͙̤̺̤͕̲̠̗̿͐̇̽͆̑͑̃́̐͑̔̆̊̌̚̕̕͜s̷̡̡̨̭͔̘̺͓̱̱̪͔̮͕͕̟̮̲͔͔̘͋̓̓̎̓͗̀̚d̷͙̝̫̝̯̩̙̟̪̹̈́̈̄̑̈́̂̍͒̽̀̓͋͌͒ͅg̸̢̢̢͕͈̩͎̼̺͖͍̞̩̪̈́̈́̒͂̇̈́́͋̐̌̈̓̉̃̄̓̈́̀̕̚̚͝͝͠ͅf̷̡̛̼̲͈͈̠͉͈͍͉̭͔̮̲̥͔̥̣̝̭͎̺̝͖̥̖̖̮̓͗̈́̽̄̔͊̏̂̈́͑̽̀̉̉̈́̀̅̑̉͑̍̍̄̀͝͠͝a̵̡̧̫̝̠̺͙̱̟̦̩̜̮̖̳̟̦̰̩̮̯͈͓̻̞̗͓͋̐̉͆d̵̢̨͔̰̟̬̺̟̲̻̱͖̣̜̙͔̲̠͂̍͆̉ģ̸̢͕̼̲̗̩̤̮̗̘̩̼͍̥̣̘̦̟̗̞̱̲̫̎́̃͗̎̊̍̆̔̉̔ͅä̶̢̧̛̛͙̥̠̦͎̟̗̬̗̟̝͖͓͔̠́͐̏͑̀̀̐̐̀͑̄̋̌̕͘͜͝͠g̸̢̨̯̟͍͚̜̙̹̯͚͈̺̖̗̬̤̙͚͖̖̰̫͎̙̀̅̋͊͑͊́̊̏̈̈̕͜͠ͅͅq̷̢̳̥̬͕̩̖̻̠͔͉̬̙͈̺̈́͗̎̆̌́̈̄̽̃̚͝͝͠ẃ̷̨̗̺̫̙̻̼̻͍̟͙͙̼̺̦̫̐̍̿̔̐͐͂̕͜ë̶̢̝̝͇̞̪́̎̀̍͂͝q̷̨̛̞͍̩̟̤̬̬͎̜̤̠͍͖̺̭̪̻͎̟̜͖̤̈́̑́̓̿̆͗̔̐̎̊̔́̈́̓́͊̔͛̇̐͋̅̆͘̚̕͝ͅw̵̨̡̥̤̘̦͎͇̖̙̺̣̟̫͙̜̤̹͙͙̪̆͘ͅę̴͉̱̱̲̺̘̖͉̯͔͔͚̟͖̥̥͔̤̗͕̦̰̑͐̎͐̾̉͊̀̌̆̿̃͛͜͠ͅͅͅr̸̡̢̨̧̖͚̮̻͕̙̘̠̞͕̤̮͈̰̰̺̞̤̼̊̿͑́̌̿͌̓̓̋͗̒̐́̈́̈́̎͛̎͑̐̑̚̚͘͜͜͠q̷̲̩̭̺̱̝͍̦̬̱̦̯͗̋́̐̈̐̌̈́͑̍̀͗̆̇̆̃́̀̉́͌̕͜͝͠ṛ̴̨̧̡̛̮̭͖̞̥̥̻̟͉̻̩͖̝͕̮͈̺̖͕̜͕̫̮̠͕̐̅̂̂̃̇̉̃́͆̊͗̇͐̊̽̆̈́̎̀͒̎̒͛͘̕̕f̶̩̩̞̭̼̘͕̞̲̌̌́̅͒́̕͜ͅͅ\n" +
                        "\n" +
                        "a̵̫̲͔͉̍s̷̛̛̠̖̐̉̿̌́̊͒̆̏̃̇̕ͅḑ̸͇̼̖̥̖͙̲͈̥̰̬͙̂̆̋̾̇͐͋̑̒̕̚͝͝g̴̽̎́̀͜f̷̡̭̖̥̤͎̤̦̪̖͂̑͂̽̓̽̆̽͜ͅã̵̦̭͓̔̓̍̀̋͂͛͠͠ͅḑ̴̲̓̀͆̽̆͂̈́̃ģ̵̢͙̭̹͓̟̲͙̙͈͎͕̬̿̂̚͠ȧ̸̧̓̾̍̓̌̒́̑̔g̴̢̢̭͈̮͔̠̰̻̱͎̖̩͖̣̐̎̽̃͗́͝͝q̶̛̞̻̞̯͔̫̥͕̻͍̲̩͐̇͌͌̋̍̈́̆͌̒͝͝͠w̷̢͎̤̳̠̘̰̳̮̯̓̾̆̐̕ȩ̷͔̅q̶̡̨̛͓̪͍̠̦͇̫̀́̀͠ẅ̶̧̡̪͔͉̩̺̲̼̳̺́͑̍͂̀͗͆͗̈̚͜͝ȩ̶̟͕͚̭̝̱͈͈̩̝͔̝͒̿̂͋r̷̡̩͐̈͋͛̆͒̈́̄̈́̉͋̽͋̒q̵̛̩̩̜̓͊͆͂̽̾͝͝r̸̢͎̭͎̔̀͌̒́͊͛͌͑̃̌̔̕͘͠f̴̧͉̠̤̰̫͖̻̩͉̜͓̌͒́\n" +
                        "\n" +
                        "ȁ̵̝̭̮̹̥̦̂̏̿̈͌͛ͅş̶̨̤̳̼̮͓̑͝d̵̡̜̣̪͔͍̪̼̣̋̔ḡ̶̨̬̍̀̏̈̽̄͌̚f̴̘̜͇̼̪͇̂̎̑̏a̸̡̧̞̲̜̩̘̦̔d̵͍̱̮͒̀͒̐g̸̡̟͈̭͔̗̻̝̈́͜a̷̦͈̪̞̔ǧ̷̢͕͚̣̺̰̖̕q̴͔͕͔̿͛͂͛̅͗̊w̶̝͉̻͆̊̊̀͌̒͂e̵̦̼̻̰̪̣̫̝͗͊͂͐q̶̨̠̲͓̬̓͛͊̊̋͆̒̀͝w̸̧̱͎͍͈̯̫͗͊́̒̇̀̒͐͌̊ͅẻ̵̹̫̳͙͔͓͕̘͈̃̂̓ȑ̴͔̫̀͂̚q̶̨̺̤̗͓̱̪̼͠r̷̳̫͍͔͇̽̇̾̏̃̓̆͗̅͐f̸̛̮͖̘̻̩̐̑̂̆̍̈̕̚͝ͅ\n" +
                        "\n" +
                        "a̴̝̦̼͉͌̿́͝s̵̻̞̅̂͌̕͝d̵̖̬͖̪̜̋́̊ģ̸̹̩̗̉͆̚̕f̶͚̣̿̈́ā̸̳͍̯d̴͙̠̽͛̃̐̔g̴͕͗â̸̗͔͆͠ĝ̴͓̤͆̐͌̀q̴̝̇̾̄̈́͠ͅw̴̠̒̎̀͛͝ẹ̵͙̗͖͊̿̇͊q̵̡̗͓͕͈̓͂̀w̶̳̖̳͋͌̃̏͂ͅͅȩ̷̻̞̇ȓ̴̨͙̟̝͆̓̿́q̶̗̆ȓ̵̡͈̬͍͓̍̉̀͝f̴̱̮̙͓͙̒͗̐\n" +
                        "\n" +
                        "à̵̯̣͇̌͑s̶̫̯̓d̸͌̉ͅg̸̦͙͕͊f̵͉͆a̵̦̣͒̍̅d̵̻͔͒̅g̷̙̖͘å̵̠̅g̷̢̨̠̀̊͛q̷̱̓͑w̵̪̔́ͅe̵̢̍͛̃q̵͚̣̼̎̇̃w̷̻̑̚ȩ̸̛̪̫̀̕r̶̗̯͌q̷̑̉ͅr̸͈̐̊̒f̷̗͌̚\n" +
                        "\n" +
                        "ȧ̶͚̖s̴̛̟̮̆d̸̨̜̚ġ̴̗f̷̞̀a̷̡̤͒d̸͖͗̍g̵̗̅ả̴̞g̶̭̾͋q̶̰̈w̴͑͜e̶̦͒͝q̶̥̭͗ẃ̵͕͎̃ê̸̻̗͌r̴̨̜͒q̷̫̺̇̚ṟ̶͓̓̊f̴͉͋̕͜\n" +
                        "\n" +
                        "𝔞𝔰𝔡𝔤𝔣𝔞𝔡𝔤𝔞𝔤𝔮𝔴𝔢𝔮𝔴𝔢𝔯𝔮𝔯𝔣",
                "18375 0cZcvfq3452g.dmas.,madsfg2301534760dsa.fmadfvzcvbzfgbwer6598u'l\n" +
                        "a'dsffavc`q0",
        ]

        rhs << [
                "r",
                "24hvJ1j3GQNpMrMCsCZePAw9ivwf69wJrPQud7R5dtMYF1w2WGebLiYxuYrSociyByGM4rnAeBP6mSDU4F6i3PBq29g5DSmgUR2QPmwA5eZuHge87uwBfkWPM8hQ1p4wGAMzAmrCTuaDCPPwhE5J8pL1rVSGwuvLs4s31iQkcbH6bP2yx8hfnKeVScLgjStUWjVPioekozWxMFYkFkFv2j46HpnMBeEEC6LrqPp2LVYNrmjoWtp2hUBFAqzYxFLsZjJGh8NQZmo8bms6YFdxRVzYgnVsebx57fXNJAzK894wArVJrda7JVdB9pfEnkiCSLj3btipTpG1FTryzqK7HPmeKRpXnBNFBDUT7i8HUzJrGGAXbQMufLfTgXkekfVxpoTs1zPjrmPmA4cF5R7kdkJvDv8HQHw281vKYk7faYfa5dKD9bZWGMp6kAR6Y8GE9goVfmzQFbTCryN51pwBcbEpA39R11AuyKfcddK89rhX8Q75E1sGav7fYsbBLwd9KiWQGZCoeMbtneMD8SJhVn8rcGodFer9DQ1QwNW4sSMAit72c2Mk9txZUxxfPV2aRnnsQQX76ZV3frohNdSBXNx3Zbj36GvapRnksBm1ndJL51w5hDy9m2duxncMHtN6FCah8sjue9y3cV1xSutBcSTLKp9AEQLz5w93QkSRt6RHJBV82yW7dTN6k3AHwCRT3t45JiczEyqmvqPSgtqY6yDeqGUkQVFfMwDRd59WjnEe6JVeRGKxD8WSRPgNbQvqVmJYnhNhEqip3NJBdBLe5Lfg8bbwv9BaG6924mab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ffJaM8ShZBtm3WmsMBskereuv68nVFzcYYM6LSXwUc2oYt8A94WtrbETQvb2UDFhsmbTF8iwRSmE9eZrga36tJ8yk9ERTfvx44SEAR6nVpMWQrECyGbgpbaxGrrqsZhfVY61saKcJTnihXdKQK9hjLVTkxsLT72fnc9VJxMV4qcdKbNjLZKLn7scbJxnxS8iCMK77te87BQRMcjaf3oeZ7nQTezFHsnbytEjwAZWYCWoNptVdJMwuEvDX1gg4TfNn5oTTAeJH5MYLG5UH34ZVomfDmtenxQWygSH9NRF1Eiuum6M4tkU7Hzk7csN7jBq9UFq5JtFZUe9g1hcUhv3vrGJtWc4ydsGLwqvQ3s1M3BLFuJTEdfg2E63dmVPZUjabfnwrwKKMaS27tp8nbbKKGDGXz9BZ5gnsUwjNbw8ARK7b6J4wC1Wig1vqbfqiAyCJAd4sNSMyHufAHmiMufGY5JmtdpndcrYETmUZTrjFTrdtXw89DzZPbV6VjT25nCNZ7f19AP4btcm8u4LKkEp4ATuKGj7gsKdzQ3ydacSXbh27i9UrGXtqD7KVumnti8mtBQe2fNoV1QU3pTfnkZshqy1Usw2D1qN7MqA3yExTQjGHRtadM9VEf3WEecGXsPwdu9m9J9eZnUTQguWiWRGCZwJHfnz2ydq4",
                "BT2qnoVRJxC2De4rroim3qC3YUrMx98ccXJxD1deyL6s6WDsXoeKU4tHVYAAz6x5SouurpNAwVTvirZf2bzxBDbpFJcoDHbM5yABsdU78WzoucgF"
        ]
    }


    def "encoding and decoding ropes must work"() {
        expect:
        def encoding = Encodings.create(Encodings.Type.Base58);
        def encoded = encoding.encode(new Rope(lhs))
        def rhs = encoding.decode(encoded)
        rhs == lhs


        where:
        lhs << [
                "1",
                "18375 0cZcvfq3452g.dmas.,madsfg2301534760dsa.fmadfvzcvbzfgbwer6598u'l\n" +
                        "a'dsffavc`q0"
        ]

    }

    def "encoding inputstreams in base58 must work"() {

        expect:


        def encoding = Encodings.create(Encodings.Type.Base58);
        def lhsr = encoding.encode(new Rope(lhs))
        def rhsr = new Rope(rhs);
        lhsr == rhsr

        where:
        lhs << [
                "1",
                "18375 0cZcvfq3452g.dmas.,madsfg2301534760dsa.fmadfvzcvbzfgbwer6598u'l\n" +
                        "a'dsffavc`q0"
        ]

        rhs << [
                "r",
                "BT2qnoVRJxC2De4rroim3qC3YUrMx98ccXJxD1deyL6s6WDsXoeKU4tHVYAAz6x5SouurpNAwVTvirZf2bzxBDbpFJcoDHbM5yABsdU78WzoucgF"
        ]
    }


    def "decoding inputstreams to outputstreams in base58 must work"() {

        expect:
        def encoding = Encodings.create(Encodings.Type.Base58);
        def inputStream = new ByteArrayInputStream(lhs.getBytes(Charset.defaultCharset()));
        def outputStream = new ByteArrayOutputStream();
        encoding.decode(inputStream, outputStream, Charset.defaultCharset())
        outputStream.toString(Charset.defaultCharset()) == rhs
        where:
        rhs << [
                "1",
                "ä̶͓̠́͌́̄̽͗̄̆́͌̉͠͝ͅ",
                "18375 0cZcvfq3452g.dmas.,madsfg2301534760dsa.fmadfvzcvbzfgbwer6598u'l\n" +
                        "a'dsffavc`q0"
        ]
        lhs << [
                "r",
                "AkzQ9RbDBvr2CrPCFUi7hdjRAf8Kd19JTca8WzrxZAm4KWNB",
                "BT2qnoVRJxC2De4rroim3qC3YUrMx98ccXJxD1deyL6s6WDsXoeKU4tHVYAAz6x5SouurpNAwVTvirZf2bzxBDbpFJcoDHbM5yABsdU78WzoucgF"
        ]
    }

}
